package com.oracle.application.feign;



import com.oracle.application.entity.PagePo;
import com.oracle.application.entity.Product;
import com.oracle.application.entity.Protype;
import com.oracle.application.vo.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

@FeignClient(value = "BookStore-Product-Server")
public interface ProductFeign {
    /**
     * 获取所有图书
     * @return
     */
    @RequestMapping("/product/getAllProduct")
    public R<PagePo> getAllProduct(@RequestParam(value = "psgeIndex",defaultValue = "1")Integer pageIndex, @RequestParam(value = "pageCount",defaultValue = "10")Integer pageCount);
    /**
     * 根据id获取单个图书
     * @param id
     * @return
     */
    @RequestMapping("/product/getProductById")
    public R<Product> getProductById(@RequestParam("id") Integer id);
    /**
     * 添加图书
     * @param product：图书
     * @param typeid：类型id
     * @return
     */
    @RequestMapping("/product/insetProduct")
    public R insetProduct(@RequestBody Product product,@RequestParam("typeid")  Integer typeid);
    /**
     * 删除图书
     * @param id：图书id
     * @return
     */
    @RequestMapping("/product/removeProduct")
    public R removeProduct(@RequestParam("id") Integer id);
    /**
     * 修改图书
     * @param product：图书
     * @param typeid：类型id(无修改为0)
     * @return
     */
    @RequestMapping("/product/updateProduct")
    public R updateProduct(@RequestBody Product product,@RequestParam("typeid") Integer typeid);

    @RequestMapping("/protype/getAllProType")
    public R<List<Protype>> getAllProType();

}
